#ifndef __CPRICE__
#define __CPRICE__
#include <string>
#include "Contract.h"
#include "Order.h"
#include "readpair.h"
#include "EWrapper.h"


using namespace std;

typedef struct realorder_{
  Contract cmaster;
  Order omaster;
  Contract cslave;
  Order oslave;
} realorder;

struct cprice{
  cprice():bid(0),ask(0){}
  double bid;
  int bidsize;
  double ask;
  int asksize;
};

struct cdiff{
  cdiff():master(),slave(),lspread(0.0),sspread(.0),masterpos(0),slavepos(0){}
  cprice master;
  cprice slave;
  double lspread;
  double sspread;
  int masterpos;
  int slavepos;
  Contract *mc;
  Contract *sc;
  
  void u_limit(bool ismaster, TickType t, spread* spread_band);
  void updatespread_market(bool ismaster, TickType t, const spread& firstitemofspreads);
};


void liquidate_limitorder(Contract* pmster,double mbid, double mask,
    Contract* pslave, double sbid, double sask,
    int masterposition, int slaveposition);

void tradespread_limitorder(Contract* pmster,double masterprice,
    Contract* pslave, double slaveprice,
    int size, bool islong);

pair<string,string> GetExchangeCurrency(const string& symbol);

#endif
